import 'package:flutter/material.dart';
import 'Contants.dart';

class GridViewBuilderPage extends StatelessWidget {
  List<FuliBean> fulist = FuliData.fuliList;

  @override
  Widget build(BuildContext context) {
    return GridView.builder(
        padding: EdgeInsets.all(5.0),
        itemCount: fulist.length,
        gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
          crossAxisCount: 2,
          crossAxisSpacing: 10.0,
          mainAxisSpacing: 10.0,
        ),
        itemBuilder: _builderGridItem);
  }

  Widget _builderGridItem(BuildContext context, int index) {
    FuliBean fuli = fulist[index];
    return Stack(
      children: <Widget>[
        SizedBox.expand(
          child: Image.network(
            fuli.url,
            fit: BoxFit.cover,
          ),
        ),
        Positioned(
            bottom: 2.0,
            left: 2.0,
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: <Widget>[
                Text(
                  fuli.who,
                  style: TextStyle(
                      fontSize: 14.0,
                      fontWeight: FontWeight.bold,
                      color: Colors.black),
                ),
                SizedBox(
                  height: 5.0,
                ),
                Text(
                  fuli.publishTime,
                  style: TextStyle(color: Colors.black54, fontSize: 10.0),
                )
              ],
            ))
      ],
    );
  }
}
